import { MongoClient, ServerApiVersion } from "mongodb";

const uri = "mongodb+srv://vegetablecaii:vegetablecaii@viya.z4btj.mongodb.net/?retryWrites=true&w=majority&appName=viya";
const client = new MongoClient(uri,{
    serverApi: {
      version: ServerApiVersion.v1,
      strict: true,
      deprecationErrors: true,
    }
  })

async function run() {
    try {
        const database = client.db('sample_mflix')
        const movies = database.collection('movies')

        const query = { title: "A Corner in Wheat" }
        const movie = await movies.findOne(query)
        console.log(movie)
    } finally {
        await client.close()
    }
}

run().catch(console.dir)

